<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
		<title>生命体征检测云平台</title>
		<link rel="shortcut icon" href="static/logo.ico" />
		<link rel="stylesheet" href="static/css/index.css" />
		<link rel="stylesheet" href="static/layui/css/layui.css" />
		<script type="text/javascript" src="static/js/jquery.min.js"></script>
		<script src="static/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript" src="static/js/vue.js"></script>
		<script type="text/javascript" src="static/js/axios.min.js"></script>
		<style>
			html,
			body,
			#container {
				height: 100%;
				width: 100%;
			}

			.container {
				height: auto;
				width: 100%;
			}

			.container 2 {
				height: auto;
				width: 100%;
			}

			.collision-btn.disable {
				background-image: none;
				color: lightgrey;
				border-color: lightgrey;
				cursor: not-allowed;
			}

			.collision-btn.disable:hover {
				background-color: #fff;
				border-color: lightgrey;
			}

			.input-card .btn {
				margin-right: .8rem;
			}

			.amap-marker {
				opacity: 0.01;
			}

			.nav-right {
				top: 1.5rem !important;
			}

			.info {
				z-index: 999 !important;
			}

			.layui-form-label {
				width: 110px;
				font-size: 14px !important;
			}

			::-webkit-input-placeholder {
				/*Webkit browsers*/
				color: #999;
				font-size: 13px;
			}

			:-moz-placeholder {
				/*Mozilla Firefox 4 to 8*/
				color: #999;
				font-size: 13px;
			}

			::moz-placeholder {
				/*Mozilla Firefox 19+*/
				color: #999;
				font-size: 13px;
			}

			:-ms-input-placeholder {
				/*Internet Explorer 10+*/
				color: #999;
				font-size: 13px;
			}

			.layui-form-pane .layui-input {
				height: 38px !important;
			}

			.layui-layer-btn .layui-layer-btn0 {
				border-color: #063683;
				background-color: #063683;
				color: #fff;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<input type="hidden" value="1" id="tapval" />
			<div style="margin-top: 70px;background-color: #e5e5e5;"></div>
			<div class="layui-panel" style="float: left; width: 10% !important;" id="pnav">
			</div>
			<div class="container" style="width: 90% !important; float: right;padding-left: 30px;">
				<div class="layui-fluid">
					<fieldset class="layui-elem-field layui-field-title">
						<legend>健康状态</legend>
					</fieldset>
					<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
						<ul class="layui-tab-title" style="width: 94%;float: left;">
							<li>过往病史</li>
							<li>基础病</li>
							<li>不适症状</li>
						</ul>
						<a class="layui-btn" href="javascript:void(0);"
							style="float: right;height: 28px;line-height: 30px !important;width: 60px!important;
							height: 30px!important;padding:0!important;font-size: 10px!important;background-color: #063683!important;border-radius: 5px;margin-right: 30px;"
							v-on:click="addJbs">添加</a>
						<div class="layui-tab-content" style="height: 100px;">
							<div class="layui-tab-item layui-show">

								<div class="layui-col-md12 textshow" style="font-size: 16px;padding: 10px;">
									<div class="layui-bg-gray">
										<div class="layui-row layui-col-space15" v-if="bfodList.length != 0">
											<div class="layui-col-md6" v-for="bfodList in bfodList">
												<div class="layui-card">
													<div class="layui-card-header">{{bfodList.jbOneContent}}
														<div style="float: right;margin-top: 5px;">
															<a class="layui-btn layui-btn-normal"
																href="javascript:void(0);"
																style="float: left; height: 25px; line-height: 25px !important; background-color: rgb(255, 255, 255) !important; color: rgb(61, 110, 255);"
																v-on:click="delJbs(bfodList.id)">删除</a>
														</div>
													</div>
													<div class="layui-card-body">
														{{bfodList.bz}}
													</div>
												</div>
											</div>
										</div>
										<div class="layui-row layui-col-space15" v-else>
											<div class="layui-col-md6">
												<div class="layui-card">
													<div class="layui-card-header">暂无数据</div>
													<div class="layui-card-body">
														<!-- 地址：C1:D1:C5:0F:DD:E1 <br> 电量：60%  <br> 状态：在线 -->
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>



							</div>
							<div class="layui-tab-item">

								<div class="layui-col-md12 textshow" style="font-size: 16px;padding: 10px;">
									<div class="layui-bg-gray">
										<div class="layui-row layui-col-space15" v-if="bfodList.length != 0">
											<div class="layui-col-md6" v-for="bfodList in bfodList">
												<div class="layui-card">
													<div class="layui-card-header">{{bfodList.jbOneContent}}
														<div style="float: right;margin-top: 5px;">
															<a class="layui-btn layui-btn-normal"
																href="javascript:void(0);"
																style="float: left; height: 25px; line-height: 25px !important; background-color: rgb(255, 255, 255) !important; color: rgb(61, 110, 255);"
																v-on:click="delJbs(bfodList.id)">删除</a>
														</div>
													</div>
													<div class="layui-card-body">
														{{bfodList.bz}}
													</div>
												</div>
											</div>
										</div>
										<div class="layui-row layui-col-space15" v-else>
											<div class="layui-col-md6">
												<div class="layui-card">
													<div class="layui-card-header">暂无数据</div>
													<div class="layui-card-body">
														<!-- 地址：C1:D1:C5:0F:DD:E1 <br> 电量：60%  <br> 状态：在线 -->
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>

							</div>
							<div class="layui-tab-item">

								<div class="layui-col-md12 textshow" style="font-size: 16px;padding: 10px;">
									<div class="layui-bg-gray">
										<div class="layui-row layui-col-space15" v-if="bfodList.length != 0">
											<div class="layui-col-md6" v-for="bfodList in bfodList">
												<div class="layui-card">
													<div class="layui-card-header">
														{{bfodList.jbOneContent}}
														<div style="float: right;margin-top: 5px;">
															<a class="layui-btn layui-btn-normal"
																href="javascript:void(0);"
																style="float: left; height: 25px; line-height: 25px !important; background-color: rgb(255, 255, 255) !important; color: rgb(61, 110, 255);"
																v-on:click="delJbs(bfodList.id)">删除</a>
														</div>
													</div>
													<div class="layui-card-body">
														{{bfodList.bz}}
													</div>
												</div>
											</div>
										</div>
										<div class="layui-row layui-col-space15" v-else>
											<div class="layui-col-md6">
												<div class="layui-card">
													<div class="layui-card-header">暂无数据</div>
													<div class="layui-card-body">
														<!-- 地址：C1:D1:C5:0F:DD:E1 <br> 电量：60%  <br> 状态：在线 -->
													</div>
												</div>
											</div>
										</div>
									</div>
								</div>


							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="info">
				<div class="nav-left">
					<a class="login"></a>
					<a class="hometext" href="index.html" v-if="uInfoData.loginType !=1">首页</a>
					<a class="hometext" href="home.html" v-if="uInfoData.loginType == 1">首页</a>
				</div>
				<div class="nav-right">
					<ul>
						<li><a href="monitoring.html" v-if="uInfoData.loginType !=1">监测</a></li>
						<li><a href="historical_data.html" v-if="uInfoData.loginType !=1">历史数据</a></li>
						<li><a href="historical_info.html" v-if="uInfoData.loginType == 1">历史数据</a></li>
						<li><a href="call_p.html">离床报警</a></li>
						<li><a href="#">康养中心</a></li>
						<li><a href="#">中医问诊</a></li>
					</ul>
				</div>
				<div class="userinfo" id="userinfo">
					<img src="static/image/user.png" />
					<!-- <div class="red-dot"></div> -->
					<ul class="user_dropdown">
						<li class="dropdown_item user_ctrl">
							<div class="nickname">{{uInfoData.userName}}</div>
							<div class="sign_out">退出</div>
						</li>
						<li class="dropdown_item msg_item">
							<a href="user.html" target="_blank">
								<span>个人中心</span>
							</a>
						</li>
						<li class="dropdown_item msg_item">
							<a href="my_message.html" target="_blank">
								<span>我的消息</span>
								<span class="msg_unread unread_count show">5</span>
							</a>
						</li>
						<li class="dropdown_item">
							<a href="equipment.html">
								<span>设备</span>
							</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
		<script>
			var forms = '';
			$(function() {
				$("#pnav").load("public_navigation.html");
				$(".sign_out").click(function() {
					localStorage.clear();
					window.location = 'login.html'
				});
			});
		</script>
		<script type="text/javascript" src="static/js/config.js"></script>
		<script>
			var datas = [];
			var vm = new Vue({
				el: '#app', //设置当前vue对象可以操作数据的范围,注意不要把vue对象绑定到body中，因为这样，vue需要控制整个页面的内容，效率太低了
				data: {
					uInfoData: [],
					uJobList: [],
					bfodList: [],
					sex: 1,
					zhiye: '',
					shequ: ''
				},
				created: function() {
					this.getdata();
					this.layuint();
				},
				methods: {
					getdata: function() {
						var rloginName = localStorage.loginName;
						var userId = "15536684321";
						localStorage['Jbsttype'] = 1;
						console.log(rloginName)
						if (rloginName == '' || rloginName == 'null' || rloginName == undefined) {
							layer.msg('登录过期或者无权访问！', {
								time: 1000,
								end: function() {
									location.href = 'login.html'
								}
							})
						} else {
							axios({
									method: 'GET',
									url: url + "/user/userInfo/lquserOwnInfo?phoneNum=" + rloginName,
									data: {}
								})
								.then(function(response) {
									vm.uInfoData = response.data;
									vm.sex = response.data.sex;
								})

							var fdata = new FormData();
							fdata.append("userId", rloginName);
							fdata.append("jbType", 1);
							axios({
									method: 'POST',
									url: url + "/param/code/getUserjbList",
									data: fdata
								})
								.then(function(response) {
									vm.bfodList = response.data;
								})
						}
					},
					setdata: function() {
						var userName = vm.uInfoData.userName;
						var sex = $('input[name="sex"]:checked').val();
						var phone = vm.uInfoData.phone;
						var hight = $('#shenggao').val();
						var weight = $('#tizhong').val();
						var bringDate = $('#date1').val();
						var jobCode = $('#jobid').val();
						// var sqid = $('#sqid').val();
						axios({
								method: 'GET',
								url: url + "/user/userInfo/lQuserOwnUpdateNoPhoto?loginPhone=" + phone +
									"&userName=" + userName + "&sex=" + sex + "&hight=" + hight + "&weight=" +
									weight + "&bringDate=" + bringDate + "&jobCode=" +
									jobCode, // + "&communityId=" +
								sqid,
								data: {}
							})
							.then(function(response) {
								var code = response.data.code;
								var message = response.data.message;
								if (code == 0) {
									layer.msg(message, {
										time: 2000,
										end: function() {
											location.href = 'home.html'
										}
									})
								} else {
									layer.msg(message)
								}
							})
							.catch(function(error) {
								console.log(error);
							});
					},
					layuint: function() {
						layui.use(['form', 'layedit', 'laydate', 'element', 'dropdown'], function() {
							var form = layui.form,
								layer = layui.layer,
								layedit = layui.layedit,
								laydate = layui.laydate,
								element = layui.element,
								dropdown = layui.dropdown;
							forms = layui.form;
							var data = vm.sex;
							console.log(data);
							dropdown.on('click(docDemoMenu1)', function(options) {
								var othis = $(this); //当前菜单列表的 DOM 对象
								console.log(options.url)
							});
							laydate.render({
								elem: '#date1'
							});
							element.on('tab(docDemoTabBrief)', function(data) {
								var rloginName = localStorage.loginName;
								localStorage['Jbsttype'] = data.index + 1;
								$.ajax({
									type: 'POST',
									url: url + '/param/code/getUserjbList',
									async: false,
									data: {
										"userId": rloginName,
										"jbType": data.index + 1
									},
									success: function(res) {
										vm.bfodList = res;
										console.log(res)
									}
								});

							});
						});
					},
					delJbs: function(id) {
						var datas = new FormData();
						datas.append("id", id);

						layer.confirm('您是要删除此症状嘛？', {
							btn: ['确定', '取消'] //按钮
						}, function() {
							axios({
									method: 'post',
									url: url + "/param/code/deluserJbs",
									data: datas
								})
								.then(function(response) {
									var code = response.data.code;
									var message = response.data.message;
									if (code == 0) {
										layer.msg(message, {
											time: 2000,
											end: function() {
												location.href = 'basis_of_disease.html'
											}
										})
									} else {
										layer.msg(message)
									}
								})
								.catch(function(error) {
									console.log(error);
								});
						});
					},
					addJbs: function() {
						var Jbsttype = localStorage.Jbsttype;
						var rloginName = localStorage.loginName;
						let str = '';
						$.ajax({
							url: url + "/param/code/guowangjb",
							dataType: 'json',
							type: 'post',
							async: false,
							success: function(res) {
								console.log(res)

								if (Jbsttype == 1) {
									$.each(res.olddisease, function(index, item) {
										str += '<input type="checkbox" name="jsb"  value="' +
											item.codeValue + '" title="' + item.codeName +
											'" ><span  style="margin-left: 0;margin-right: 20px;">' +
											item.codeName + '</span>';
									});
								} else if (Jbsttype == 2) {
									$.each(res.jichudisease, function(index, item) {
										str += '<input type="checkbox" name="jsb"  value="' +
											item.codeValue + '" title="' + item.codeName +
											'" ><span  style="margin-left: 0;margin-right: 20px;">' +
											item.codeName + '</span>';
									});
								} else if (Jbsttype == 3) {
									$.each(res.bushidisease, function(index, item) {
										str += '<input type="checkbox" name="jsb"  value="' +
											item.codeValue + '" title="' + item.codeName +
											'" ><span  style="margin-left: 0;margin-right: 20px;">' +
											item.codeName + '</span>';
									});
								}
							}
						});
						let contents =
							'<div class="layui-form-item" pane="">  <label class="layui-form-label" style="width: 60px;margin: 0;">类型</label> <div class="layui-input-block"  style="margin-left: 10px;">' +
							str +
							'</div></div>  <div class="layui-form-item layui-form-text"> <label class="layui-form-label"  style="width: 60px;margin: 0;">备注</label><div class="layui-input-block"  style="margin-left: 10px;"><textarea placeholder="请输入备注信息" class="layui-textarea" id="jcbval"></textarea></div></div>';
						layer.open({
							title: '添加病史',
							btn: ['添加', '取消'],
							content: contents,
							yes: function(index, layero) {
								var chk_value = []; 
								$('input[name="jsb"]:checked').each(function() {
									chk_value.push($(this).val());
								});
								var jcbval = $('#jcbval').val();
								var jsbIds = chk_value.join(",");
								console.log(jsbIds);
								console.log(jcbval);
								let datas =new FormData();
								datas.append("userId",rloginName);
								datas.append("jbType",Jbsttype);
								datas.append("jbList",jsbIds);
								datas.append("bz",jcbval);
								axios({
									method: 'post',
									url: url + "/param/code/userJbsAdd",
									data: datas
								})
								.then(function(response) {
									var code = response.data.code;
									var message = response.data.message;
									if (code == 0) {
										localStorage["Jbsttype"]=Jbsttype;
										layer.msg(message, {
											time: 2000,
											end: function() {
												location.href = 'basis_of_disease.html'
											}
										})
									} else {
										layer.msg(message)
									}
								})
								.catch(function(error) {
									console.log(error);
								});
							},
							btn2: function(index, layero) {
								layer.close(index);
							},
							cancel: function(index, layero) {
								if (layer.confirm('确定要关闭么')) {
									layer.close(index);
								}
								return false;
							}
						});
					}
				}
			})
		</script>
	</body>
</html>
